package database;

public class Patient extends Individual {

	private RecordList records = new RecordList();

	public Patient(String name, Doctor doctor) {
		this.name = name;
		read = PERSONAL;
	}

	public void addChangeListener(ChangeListener cl) {
		super.addChangeListener(cl);
		for (Record record : records)
			record.addChangeListener(cl);
	}

	public void addRecord(Record record) {
		records.add(record);
		for (ChangeListener cl : changeListeners) {
			record.addChangeListener(cl);
			cl.change(record);
		}
	}

	public RecordList getRecords() {
		return records;
	}

	public String toString() {
		String str = "---Patient file---\n" + "Name: \t\t" + name + "\n";
		for (Record record : records)
			str += record.toString() + "\n";
		str += "---End of patient file---";
		return str;
	}

}
